<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>输入圆的半径计算面积和周长</title>

</head>

<body>
    <div>圆的半径：<input id="r" type="text"></input>
    </div>
    <div>圆的周长：<input id="perimeter" type="text"></input>
    </div>
    <div>圆的面积：<input id="area" type="text"></input>
    </div>

    <script>
        var redius = prompt('请输入圆的半径')

        if (!isNaN(redius)) {
            document.getElementById('r').value = redius
            document.getElementById('perimeter').value = (parseFloat(redius) * Math.PI * 2).toFixed(2)
            document.getElementById('area').value = (parseFloat(redius) * Math.PI * parseFloat(redius)).toFixed(2)
        } else {
            alert('请输入正确数字')
        }
    </script>

</body>

</html>